<template>
  <div>
    <h1></h1>
    <input type="text" placeholder="今个儿，您吃了吗？" v-model="content" @keyup.enter="dataToStore">
  </div>
</template>

<script>
export default {
  data() {
    return {
      content:""
    }
  },
  methods: {
    dataToStore(){
      //封装数据
      let todo={
        id:new Date().getTime(),
        content:this.content,
        isComplate:false,
        isDel:false 
      }
      //子组件给父组件传值
      this.$emit('addData',todo)
      //清空输入框的数据
      this.content=""
    }
  },
}
</script>
<style lang="scss" scoped>
div{
  width: 80%;
  input{
    width:100%;
    height: 4vh;
    border: none;
    &:focus{
      outline: none;
    }
  }
  
}
</style>
